package com.github.caijinglong.handler

import com.github.caijinglong.SaveDataHandler
import com.github.caijinglong.SavedDataType
import com.github.caijinglong.bind
import com.github.caijinglong.ext.println
import com.github.caijinglong.save
import org.json.JSONObject

class GoldHandler : SaveDataHandler {

    override var jsonObject: JSONObject = JSONObject()

    fun handlerGold(gold: Int) {
        jsonObject.put("gold", gold)
    }

    companion object {
        @JvmStatic
        fun main(args: Array<String>) {
            SavedDataType.JQR.let { type ->
                GoldHandler().apply {
                    bind(type)
                    handlerGold(6000)
                    save(type)
                }
            }
        }
    }
}